package o;

import androidx.annotation.NonNull;
import com.huawei.appgallery.assistantdock.buoydock.bean.ExtraInfo;
import com.huawei.appgallery.assistantdock.buoydock.bean.ExtraInfo.AppInfo;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import o.bif.d;
import o.biu.a;

class bib {
    bib() {
    }

    static List<String> ॱ(GameInfo gameInfo) {
        List<ExtraInfo> ˋ = ˋ(gameInfo);
        if (ˋ == null) {
            Logger.ˎ("BuoyEnterGssSupport", "getGssSupportService fail , extraParam == null");
            return new ArrayList();
        }
        List<String> arrayList = new ArrayList();
        for (ExtraInfo extraInfo : ˋ) {
            if (!(extraInfo.ˊ() == null || extraInfo.ˊ().startsWith("free_form|") || extraInfo.ˊ().startsWith("free_form_clone|"))) {
                arrayList.add(d.ˊ(extraInfo.ˊ()));
            }
        }
        Logger.ˎ("BuoyEnterGssSupport", "gssEnterKeyList = " + arrayList);
        return arrayList;
    }

    static ArrayList<a> ˏ(GameInfo gameInfo) {
        List<ExtraInfo> ˋ = ˋ(gameInfo);
        if (ˋ == null) {
            Logger.ˋ("BuoyEnterGssSupport", "get not GssAppList, extraParam == null");
            return new ArrayList();
        }
        boolean ʼ = bii.ʼ();
        List ͺ = bii.ͺ();
        ArrayList<a> arrayList = new ArrayList();
        for (ExtraInfo extraInfo : ˋ) {
            if (extraInfo.ˊ() != null && ((extraInfo.ˊ().startsWith("free_form|") || extraInfo.ˊ().startsWith("free_form_clone|")) && extraInfo.ˊ().split("\\|").length > 1)) {
                String str = extraInfo.ˊ().split("\\|")[1];
                if (ˋ(ʼ, ͺ, str, extraInfo.ˋ())) {
                    Logger.ˎ("BuoyEnterGssSupport", "not display " + str);
                } else {
                    String str2;
                    String str3;
                    AppInfo ॱ = extraInfo.ॱ();
                    String ˊ = extraInfo.ˊ();
                    if (ॱ == null) {
                        str2 = null;
                    } else {
                        str2 = ॱ.ˎ();
                    }
                    if (ॱ == null) {
                        str3 = null;
                    } else {
                        str3 = ॱ.ˊ();
                    }
                    if (ॱ == null) {
                        str = null;
                    } else {
                        str = ॱ.ˋ();
                    }
                    a ˏ = a.ˏ(ˊ, str2, str3, str);
                    if (ˏ != null) {
                        arrayList.add(ˏ);
                    } else {
                        Logger.e("BuoyEnterGssSupport", "ExtraId is invalid:" + extraInfo.ˊ());
                    }
                }
            }
        }
        Logger.ˎ("BuoyEnterGssSupport", "appList = " + arrayList);
        return arrayList;
    }

    private static boolean ˋ(boolean z, @NonNull List<String> list, String str, int i) {
        if (!z && !list.contains(str)) {
            return true;
        }
        if (i == 1 || big.ˎ(str)) {
            return false;
        }
        return true;
    }

    private static List<ExtraInfo> ˋ(GameInfo gameInfo) {
        if (gameInfo == null) {
            Logger.e("BuoyEnterGssSupport", "gameInfo == null");
            return null;
        }
        ezo ˋ = ezs.ˏ().ˋ(gameInfo);
        if (ˋ != null) {
            List<ExtraInfo> ˋ2;
            for (bfo o_bfo : ˋ.ˎ()) {
                if ("buoy_gss|all_service".equals(o_bfo.ˎ())) {
                    ˋ2 = o_bfo.ˋ();
                    break;
                }
            }
            ˋ2 = null;
            if (!CollectCheck.isEmpty(ˋ2)) {
                Collections.sort(ˋ2, new Comparator<ExtraInfo>() {
                    public /* synthetic */ int compare(Object obj, Object obj2) {
                        return ˎ((ExtraInfo) obj, (ExtraInfo) obj2);
                    }

                    public int ˎ(ExtraInfo extraInfo, ExtraInfo extraInfo2) {
                        int ˏ = extraInfo.ˏ();
                        int ˏ2 = extraInfo2.ˏ();
                        if (ˏ > ˏ2) {
                            return 1;
                        }
                        return ˏ == ˏ2 ? 0 : -1;
                    }
                });
                return ˋ2;
            } else if (!Logger.ˎ()) {
                return null;
            } else {
                Logger.ˏ("BuoyEnterGssSupport", "extraParam is empty");
                return null;
            }
        } else if (!Logger.ˎ()) {
            return null;
        } else {
            Logger.ˏ("BuoyEnterGssSupport", "entryInfo is null");
            return null;
        }
    }
}
